package practicedemo57;

import java.util.ArrayList;

public class StudentUtil {
    //标砖工具类Util


    //私有化方法，防止实例对象
    private StudentUtil() {
        throw new Error("不要实例化我！！");
    }
    //获取最大年龄方法
    public static int getAge(ArrayList<Student> list) {
        int ageMax = list.get(0).getAge();
        for (int i = 1; i < list.size(); i++) {
            ageMax = ageMax > list.get(i).getAge() ? ageMax : list.get(i).getAge();
        }
        return ageMax;
    }
}
